package org.bee.util;

import org.bee.bean.BeanUtil;
import org.bee.context.JobContext;
import org.bee.model.BatchJob;

/**
 * 任务执行工具
 *
 * @author ruoyi
 */
public class JobInvokeUtil
{
    /**
     * 执行方法
     *
     * @param sysJob 系统任务
     */
    public static void invokeMethod(BatchJob batchJob) throws Exception {
        String beanName = batchJob.getBean();
        SysJob bean = BeanUtil.getBean(beanName, SysJob.class);
        JobContext jobContext = new JobContext();
        jobContext.setTaskId(batchJob.getId());
        //todo 参数
//        jobContext.setParams(batchJob.getParams());
        bean.doBusiness(jobContext);
    }

}
